﻿using Dapper.Contrib.Extensions;
using Gx.Common;
using Gx.Model.Enums;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Gx.Model.Entity
{
    [System.ComponentModel.DataAnnotations.Schema.Table("LK_WarehouseEntry")] 
    public class LKWarehouseEntry
    {
        [System.ComponentModel.DataAnnotations.Key]
        private int _id;
        /// <summary>
        /// Id
        /// </summary>
        [Column("Id")]
        public int Id 
        {
            get
            {
                return _id;
            }
            set { _id = value; }
        }
        
        
        private string _billNo;
        /// <summary>
        /// 入库单编号
        /// </summary>
        [Column("BillNo")]
        public string BillNo 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_billNo))
                    _billNo=string.Empty;
                return _billNo;
            }
            set { _billNo = value; }
        }
        
        
        private System.DateTime _entryTime;
        /// <summary>
        /// 入库时间
        /// </summary>
        [Column("EntryTime")]
        public System.DateTime EntryTime 
        {
            get
            {
                if (_entryTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _entryTime;
            }
            set { _entryTime = value; }
        }
        
        
        private string _carNumber;
        /// <summary>
        /// 车牌号
        /// </summary>
        [Column("CarNumber")]
        public string CarNumber 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_carNumber))
                    _carNumber=string.Empty;
                return _carNumber;
            }
            set { _carNumber = value; }
        }
        
        
        private string _porterNo;
        /// <summary>
        /// 搬运工单号
        /// </summary>
        [Column("PorterNo")]
        public string PorterNo 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_porterNo))
                    _porterNo=string.Empty;
                return _porterNo;
            }
            set { _porterNo = value; }
        }
        
        
        private int _customerId;
        /// <summary>
        /// 客户
        /// </summary>
        [Column("CustomerId")]
        public int CustomerId 
        {
            get
            {
                return _customerId;
            }
            set { _customerId = value; }
        }

        private string _customerNo;
        /// <summary>
        /// 客户编号
        /// </summary>
        [Column("CustomerNo")]
        public string CustomerNo
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_customerNo))
                    _customerNo = string.Empty;
                return _customerNo;
            }
            set { _customerNo = value; }
        }

        private string _customerName;
        /// <summary>
        /// 客户名称
        /// </summary>
        [Column("CustomerName")]
        public string CustomerName
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_customerName))
                    _customerName = string.Empty;
                return _customerName;
            }
            set { _customerName = value; }
        }


        private string _contractNo;
        /// <summary>
        /// 合同编号
        /// </summary>
        [Column("ContractNo")]
        public string ContractNo 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_contractNo))
                    _contractNo=string.Empty;
                return _contractNo;
            }
            set { _contractNo = value; }
        }
        
        
        private int _rentalWarehouseType;
        /// <summary>
        /// 租仓类型(1:零仓,2:包仓)
        /// </summary>
        [Column("RentalWarehouseType")]
        public int RentalWarehouseType 
        {
            get
            {
                return _rentalWarehouseType;
            }
            set { _rentalWarehouseType = value; }
        }
        
        
        private int _chargingUnit;
        /// <summary>
        /// 计费单位
        /// </summary>
        [Column("ChargingUnit")]
        public int ChargingUnit 
        {
            get
            {
                return _chargingUnit;
            }
            set { _chargingUnit = value; }
        }
        
        
        private int _coldAlgorithm;
        /// <summary>
        /// 冷藏算法
        /// </summary>
        [Column("ColdAlgorithm")]
        public int ColdAlgorithm 
        {
            get
            {
                return _coldAlgorithm;
            }
            set { _coldAlgorithm = value; }
        }
        
        
        private int _cycle;
        /// <summary>
        /// 周期
        /// </summary>
        [Column("Cycle")]
        public int Cycle 
        {
            get
            {
                return _cycle;
            }
            set { _cycle = value; }
        }
        
        
        private decimal _coldUnitPrice;
        /// <summary>
        /// 冷藏单价
        /// </summary>
        [Column("ColdUnitPrice")]
        public decimal ColdUnitPrice 
        {
            get
            {
                return _coldUnitPrice;
            }
            set { _coldUnitPrice = value; }
        }
        
        
        private decimal _totalTon;
        /// <summary>
        /// 总吨重
        /// </summary>
        [Column("TotalTon")]
        public decimal TotalTon 
        {
            get
            {
                return _totalTon;
            }
            set { _totalTon = value; }
        }
        
        
        private int _total;
        /// <summary>
        /// 总件数
        /// </summary>
        [Column("Total")]
        public int Total 
        {
            get
            {
                return _total;
            }
            set { _total = value; }
        }
        
        
        private decimal _amount;
        /// <summary>
        /// 总金额
        /// </summary>
        [Column("Amount")]
        public decimal Amount 
        {
            get
            {
                return _amount;
            }
            set { _amount = value; }
        }
        
        
        private int _tonnage;
        /// <summary>
        /// 不足n吨算n吨
        /// </summary>
        [Column("Tonnage")]
        public int Tonnage 
        {
            get
            {
                return _tonnage;
            }
            set { _tonnage = value; }
        }
        
        
        private bool _isByTon;
        /// <summary>
        /// 按吨操作
        /// </summary>
        [Column("IsByTon")]
        public bool IsByTon 
        {
            get
            {
                return _isByTon;
            }
            set { _isByTon = value; }
        }
        
        
        private string _containerNumber;
        /// <summary>
        /// 柜号
        /// </summary>
        [Column("ContainerNumber")]
        public string ContainerNumber 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_containerNumber))
                    _containerNumber=string.Empty;
                return _containerNumber;
            }
            set { _containerNumber = value; }
        }
        
        
        private string _remark;
        /// <summary>
        /// 备注
        /// </summary>
        [Column("Remark")]
        public string Remark 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_remark))
                    _remark=string.Empty;
                return _remark;
            }
            set { _remark = value; }
        }
        
        
        private bool _isReview;
        /// <summary>
        /// 是否复核
        /// </summary>
        [Column("IsReview")]
        public bool IsReview 
        {
            get
            {
                return _isReview;
            }
            set { _isReview = value; }
        }
        
        
        private System.DateTime _createTime;
        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("CreateTime")]
        public System.DateTime CreateTime 
        {
            get
            {
                if (_createTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _createTime;
            }
            set { _createTime = value; }
        }
        
        
        private int _createUserId;
        /// <summary>
        /// 创建人id
        /// </summary>
        [Column("CreateUserId")]
        public int CreateUserId 
        {
            get
            {
                return _createUserId;
            }
            set { _createUserId = value; }
        }
        
        
        private string _createUser;
        /// <summary>
        /// 创建人
        /// </summary>
        [Column("CreateUser")]
        public string CreateUser 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_createUser))
                    _createUser=string.Empty;
                return _createUser;
            }
            set { _createUser = value; }
        }
        
        
        private int _modifyUserId;
        /// <summary>
        /// 修改人id
        /// </summary>
        [Column("ModifyUserId")]
        public int ModifyUserId 
        {
            get
            {
                return _modifyUserId;
            }
            set { _modifyUserId = value; }
        }
        
        
        private string _modifyUser;
        /// <summary>
        /// 修改人
        /// </summary>
        [Column("ModifyUser")]
        public string ModifyUser 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_modifyUser))
                    _modifyUser=string.Empty;
                return _modifyUser;
            }
            set { _modifyUser = value; }
        }
        
        
        private System.DateTime _modifyTime;
        /// <summary>
        /// 修改时间
        /// </summary>
        [Column("ModifyTime")]
        public System.DateTime ModifyTime 
        {
            get
            {
                if (_modifyTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _modifyTime;
            }
            set { _modifyTime = value; }
        }
        
        
        private bool _isDeleted;
        /// <summary>
        /// 是否删除
        /// </summary>
        [Column("IsDeleted")]
        public bool IsDeleted 
        {
            get
            {
                return _isDeleted;
            }
            set { _isDeleted = value; }
        }

        private int _companyId;
        /// <summary>
        /// 公司
        /// </summary>
        [Column("CompanyId")]
        public int CompanyId
        {
            get
            {
                return _companyId;
            }
            set { _companyId = value; }
        }

        private int _status;
        /// <summary>
        /// 状态
        /// </summary>
        [Column("Status")]
        public int Status
        {
            get
            {
                return _status;
            }
            set { _status = value; }
        }

        private string _billSource;
        /// <summary>
        /// 单据来源
        /// </summary>
        [Column("BillSource")]
        public string BillSource
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_billSource))
                    _billSource = string.Empty;
                return _billSource;
            }
            set { _billSource = value; }
        }

        private System.DateTime _beginTime;
        /// <summary>
        /// 开始时间
        /// </summary>
        [Column("BeginTime")]
        public System.DateTime BeginTime
        {
            get
            {
                if (_beginTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _beginTime;
            }
            set { _beginTime = value; }
        }


        private System.DateTime _endTime;
        /// <summary>
        /// 结束时间
        /// </summary>
        [Column("EndTime")]
        public System.DateTime EndTime
        {
            get
            {
                if (_endTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _endTime;
            }
            set { _endTime = value; }
        }

        private int _reviewerId;
        /// <summary>
        /// 复核人id
        /// </summary>
        [Column("ReviewerId")]
        public int ReviewerId
        {
            get
            {
                return _reviewerId;
            }
            set { _reviewerId = value; }
        }


        private string _reviewer;
        /// <summary>
        /// 复核人
        /// </summary>
        [Column("Reviewer")]
        public string Reviewer
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_reviewer))
                    _reviewer = string.Empty;
                return _reviewer;
            }
            set { _reviewer = value; }
        }


        private System.DateTime _reviewTime;
        /// <summary>
        /// 复核时间
        /// </summary>
        [Column("ReviewerTime")]
        public System.DateTime ReviewTime
        {
            get
            {
                if (_reviewTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _reviewTime;
            }
            set { _reviewTime = value; }
        }

        [Computed]
        public string StatusName
        {
            get
            {
                return EnumHelper.GetDataTypeDescription<EntryBillStatus>(Status);
            }
        }

        [Computed]
        public string RentalWarehouseTypeName 
        {
            get
            {
                return EnumHelper.GetDataTypeDescription<RentalWarehouseTypeEnum>(RentalWarehouseType);
            }
        }
    }
}

